#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int N;
int a[105];
int count = 0;
bool dp[10005] = { false };
int gcd(int a, int b)
{
	return b == 0 ? a : gcd(b,a % b);
}
int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &a[i]);
	}
	int g = a[0];
	for (int i = 1; i < N; i++)
	{
		g=gcd(g, a[i]);
	}
	if (g != 1)
	{
		printf("INF");
	}
	else
	{
		dp[0] = true;
		for (int i = 0; i < N; i++)
		{
			for (int j = 0; j + a[i] < 10005; j++)
			{
				if (dp[j])
				{
					dp[j + a[i]] = true;
				}
			}
		}
		for (int i = 0; i <10005; i++)
		{
			if (!dp[i])
			{
				count++;
			}
		}
		printf("%d", count);
	}
	return 0;
}